// 创建路由器，并暴露

// 1. 引入createRouter
import { createRouter ,createWebHashHistory} from 'vue-router';


import Home from '@/components/Home.vue';
import About from '@/components/About.vue';
import News from '@/components/News.vue';

// 2. 通过createRouter创建路由实例
const router = createRouter({
    history:createWebHashHistory(), // 路由的工作模式
    // 3. 配置路由规则
    routes: [
        {
            path: '/home',
            component: Home,
        },
        {
            path: '/about',
            component: About,
        },
        {
            path: '/news',
            component: News,
        },
    ]
});

// 4. 暴露路由实例
export default router;  
